<?php
/************************FoxPHP威客系统************************/
/*                                                            */
/*  FoxPHP.Com (C)2006-2016 FoxPHP Inc.                       */
/*  This is NOT a freeware, use is subject to license terms   */
/*  FoxPHP威客系统是商业软件,使用于商业用途请购买授权         */
/*  V3.0 2016.3                                               */
/*  foxphp@aliyun.com                                         */
/*  http://www.foxphp.com                                     */
/*                                                            */
/**************************************************************/

namespace Get\Controller;
use Think\Controller;
class LoginController extends Controller {
	
	public function indexAction(){
		//移动
		if(intval($_GET['mobile']) && C('S_DOMAIN_ALLOW')){
			JsonAccessAllow();
		}

		$User = new \Login\Model\MemberModel();
		
		if($uid=$User->LoginSubmit()){

			$this->ajaxReturn(array('title'=>'登录成功','message'=>'登录成功!','status'=>'ok','refresh'=>true,'url'=>$User->UrlReferer(),'uc'=>$User->UcLogin($uid)),$_POST['datatype']);
		}else{
			$this->ajaxReturn(array('title'=>'登录失败','message'=>$User->getError(),'status'=>'error','data'=>$User->getError(),'refresh'=>false,'callback'=>$User->Callback()),$_POST['datatype']);
		}
	}
    
    public function statusAction(){
		//移动
		if(intval($_GET['mobile']) && C('S_DOMAIN_ALLOW')){
			JsonAccessAllow();
		}
		
	    $User = new \Member\Model\MemberModel();
	    $this->ajaxReturn(array('title'=>'登录状态','message'=>'登录状态!','status'=>'ok','data'=>$User->LoginStatus(),$_POST['datatype']));
    }
}